package com.it.okfinaldemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import cn.finalteam.okhttpfinal.HttpRequest;
import cn.finalteam.okhttpfinal.RequestParams;
import cn.finalteam.okhttpfinal.StringHttpRequestCallback;
import cn.finalteam.toolsfinal.JsonFormatUtils;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        RequestParams params = new RequestParams();
        params.addFormDataPart("page", 1);
        params.addFormDataPart("limit", 12);
        HttpRequest.post(Api.NEW_GAME, params, new StringHttpRequestCallback() {
            @Override
            protected void onSuccess(String s) {
                super.onSuccess(s);
                mTvResult.setText(JsonFormatUtils.formatJson(s));
            }
        });

        mMvCode.loadMarkdownFile("file:///android_asset/HttpRequestCallbackString.md", "file:///android_asset/css-themes/classic.css");
    }
}
